﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;


namespace CRM_SMS_MARKETING.PL.Message
{
    public partial class frmTemplate : DevExpress.XtraEditors.XtraForm
    {
        public frmTemplate()
        {
            InitializeComponent();
        }

        private void btnClearMessage_Click(object sender, EventArgs e)
        {
            txtContent.Text = "";
           
        }

        private void btnNewTemplate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            #region
            btnEditTemplate.Enabled = false;
            btnDeleteTemplate.Enabled = false;
            btnUse.Enabled = false;
            gridControlTemplate.Enabled = false;
            btnInsertField.Enabled = true;
            btnClearMessage.Enabled = true;
            btnSave.Enabled = true;
            btnCancel.Enabled = true;
            txtSubject.Properties.ReadOnly = false;
            txtContent.Properties.ReadOnly = false;
            txtSubject.Text = "";
            txtContent.Text = "";
            #endregion
        }

        private void btnEditTemplate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            #region
            btnEditTemplate.Enabled = false;
            btnDeleteTemplate.Enabled = false;
            btnUse.Enabled = false;
            gridControlTemplate.Enabled = false;
            btnInsertField.Enabled = true;
            btnClearMessage.Enabled = true;
            btnSave.Enabled = true;
            btnCancel.Enabled = true;
            txtSubject.Properties.ReadOnly = false;
            txtContent.Properties.ReadOnly = false;
            #endregion
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            #region
            btnEditTemplate.Enabled = true;
            btnDeleteTemplate.Enabled = true;
            btnUse.Enabled = true;
            gridControlTemplate.Enabled = true;
            btnInsertField.Enabled = false;
            btnClearMessage.Enabled = false;
            btnSave.Enabled = false;
            btnCancel.Enabled = false;
            txtSubject.Properties.ReadOnly = true;
            txtContent.Properties.ReadOnly = true;
            #endregion
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            #region
            btnEditTemplate.Enabled = true;
            btnDeleteTemplate.Enabled = true;
            btnUse.Enabled = true;
            gridControlTemplate.Enabled = true;
            btnInsertField.Enabled = false;
            btnClearMessage.Enabled = false;
            btnSave.Enabled = false;
            btnCancel.Enabled = false;
            txtSubject.Properties.ReadOnly = true;
            txtContent.Properties.ReadOnly = true;
            #endregion
        }

        private void frmTemplate_Load(object sender, EventArgs e)
        {
            #region EnableControl
            btnEditTemplate.Enabled = true;
            btnDeleteTemplate.Enabled = true;
            btnUse.Enabled = true;
            gridControlTemplate.Enabled = true;
            btnInsertField.Enabled = false;
            btnClearMessage.Enabled = false;
            btnSave.Enabled = false;
            btnCancel.Enabled = false;
            txtSubject.Properties.ReadOnly = true;
            txtContent.Properties.ReadOnly = true;
            #endregion 

            
        }
    }
}